﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />

<title>新增用户</title>
</head>
<body>
 <div class="pd-20">
  <form  method="post" class="form form-horizontal" id="form1">
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>用户名：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="" placeholder="输入用户名或电话号码" id="userName" name="userName" datatype="*6-11" nullmsg="用户名不能为空" >
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>初始密码：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="888888" placeholder="" id="pwd" name="pwd"  readonly="readonly">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red"></span>别名：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" placeholder="" name="nickName" id="nickName" >
      </div>
      <div class="col-4"> </div>
    </div>
 
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>用户logo：</label>
        <div class="formControls col-5">
          <%-- <img alt="浏览图片" src="<%=basePath%>common/css/wglogo.png" name="image" id="image"> --%>
          <!--用来存放item-->
          <div id="fileList" class="uploader-list" style="display:inline;">
	            <div id="WU_FILE_1" class="file-item thumbnail"> 
	                 <img src="${user_default_image_url}" style="width:100px;height:100px;"> 
	                 <div class="info"></div> 
				</div>
          </div>
          <div id="filePicker" style="display:inline;"><i class="Hui-iconfont">&#xe642;</i>选择图片</div>
       </div>
       <input type="hidden" id="image" name="image" value="${user_default_image_url}">
      <!--用来存放item-->
   <!--    <div id="fileList" class="uploader-list"></div>
      <div id="filePicker"><i class="Hui-iconfont">&#xe642;</i>选择图片</div> -->
      <div class="col-4"></div>
    </div>
    
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>性别：</label>
      <div class="formControls col-5 skin-minimal">
        <div class="radio-box">
          <input type="radio" id="sex-1" name="gender" datatype="*" nullmsg="请选择性别！" value="1">
          <label for="sex-1">男</label>
        </div>
        <div class="radio-box">
          <input type="radio" id="sex-2" name="gender" value="2">
          <label for="sex-2">女</label>
        </div>
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>真实姓名：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="" placeholder="" id="realName" name="realName"  datatype="*" nullmsg="真实姓名为空">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>手机：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="" placeholder="" id="mobileNumber" name="mobileNumber"  datatype="m" nullmsg="手机不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>邮箱：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" placeholder="@" name="email" id="email" datatype="e" nullmsg="请输入邮箱！">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3">出生日期：</label>
      <div class="formControls col-5">
       <input type="text"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'1960-01-01',maxDate:'2020-12-31'})" id="birthday" name="birthday" class="input-text Wdate" style="width:180px;" value="" >
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>身份证号：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" placeholder="" name="idCard" id="idCard" >
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>常用地址：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" placeholder="" name="address" id="address" >
      </div>
      <div class="col-4"> </div>
    </div>
     <div class="row cl">
      <label class="form-label col-3">所属角色：</label>
      <div class="formControls col-5"> <span class="select-box">
           <select class="select"  size="1" id="roleId" name="roleId"  datatype="*" nullmsg="请选择所属角色！">
		      <option value="" selected="selected">请选择</option> 
		      <c:if test="${roleList !=null}">
		       <c:forEach items="${roleList}" var="tl">
		        <option value="${tl.id}"> ${tl.description}</option>
		       </c:forEach>
		      </c:if>
		   </select>
        </span> </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3">所属组织机构：</label>
      <div class="formControls col-5"> <span class="select-box">
           <select class="select"  size="1" id="organizationId" name="organizationId"  datatype="*" nullmsg="请选择所属组织机构！">
		      <option value="" selected="selected">请选择</option>
		       <c:if test="${orgList !=null}">
		       <c:forEach items="${orgList}" var="tl">
		        <option value="${tl.id}"> ${tl.name}</option>
		       </c:forEach>
		      </c:if>
		   </select>
        </span> </div>
      <div class="col-4"> </div>
    </div>
     
    <div class="row cl">
      <div class="col-9 col-offset-3">
        <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
        &nbsp;&nbsp;<input id="closeBtn"  class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;关闭&nbsp;&nbsp;">
      </div>
    </div>
  </form>
</div>
</div>
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/My97DatePicker/WdatePicker.js"></script> 

<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/webuploader/0.1.5/webuploader.min.js"></script> 

<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/js/H-ui.js"></script> 
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/js/H-ui.admin.js"></script>
<script type="text/javascript" src="<%=basePath%>common/js/cms.js"></script>
<script type="text/javascript" src="<%=basePath%>common/js/webupload.js?v=1"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form1").Validform({
		tiptype:2,
		beforeSubmit:function(curform){
			 //在验证成功后，表单提交前执行的函数，curform参数是当前表单对象。
            //这里明确return false的话表单将不会提交;
			submitForm(curform) ;
			return false ;
		},
		callback:function(form){
			
			// submitForm(form) ;
			// form[0].submit();
			return false ;
		}
	});
	
	function submitForm(form ){
		var params = JSON.stringify( $("#form1").serializeJson()) ;
		$.ajax({
			"type": "POST", 
			"url": "<%=basePath%>usermgr/doadd"  , 
		   // "contentType":"application/json;charset=UTF-8",   
			"dataType": "json",  // 预期服务器返回的数据类型
			"data": "params="+params ,      
			"success": function(resp) {
				// console.log(resp) ;
				if(resp.success){
					    var index = parent.layer.getFrameIndex(window.name);
					    parent.$('#queryBtn').click(); 
						parent.layer.close(index);
				}else{
					layer.alert( resp.errMsg, {icon: 2},function(index){
						 layer.close(index);
					  });
				}
				 
			}
		}); 
	}
	
	
	$("#closeBtn").click(function(){
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);
	});
	
	
	
});
</script>
</body>
</html>